#!/bin/sh

sudo apt install vsftpd -y
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo systemctl start vsftpd
sudo systemctl enable vsftpd
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo cp vsftpd.conf /etc/vsftpd.conf
sudo useradd -m -c "ftpadmin" -s /bin/bash ftpadmin
sudo echo -e "ftphappy\nftphappy\n" | passwd ftpadmin
sudo echo "ftpadmin" | sudo tee -a /etc/vsftpd.allowed_users
sudo mkdir /root/ftpadmin
sudo mkdir /root/ftpadmin/ftp
sudo chown nobody:nogroup /root/ftpadmin/ftp
sudo chmod a-w /root/ftpadmin/ftp
sudo mkdir /root/ftpadmin/ftp/files
sudo chown -R ftpadmin:ftpadmin /root/ftpadmin/ftp/files
sudo chmod -R 0770 /root/ftpadmin/ftp/files
sudo systemctl restart vsftpd
